import React, { Component } from 'react'

export default class Home extends Component {
  render() {
    console.log(this.props)
    // 对象解构
    const { push, goBack, go } = this.props.history
    return (
      <div>
        Home页面
        {/* 编程式导航跳转 */}
        {/* <button onClick={() => this.props.history.push('/about')}>
          关于页面
        </button> */}
        <button onClick={() => push('/about/1000/jerry')}>关于页面</button>
        <button onClick={() => push('/news?id=100&age=100')}>新闻页面</button>
        <button
          onClick={() =>
            push({
              pathname: '/news',
              search: 'id=200&age=200',
              state: {
                isAuth: false
              }
            })
          }
        >
          新闻页面
        </button>
        <button onClick={() => goBack()}>返回</button>
        <button onClick={() => go(-1)}>返回</button>
      </div>
    )
  }
}
